<SCRIPT LANGUAGE="JavaScript">
startday = new Date();
clockStart = startday.getTime();

function initStopwatch() {
   var myTime = new Date(); 
   var timeNow = myTime.getTime();  
   var timeDiff = timeNow - clockStart; 
   this.diffSecs = timeDiff/1000; 
   return(this.diffSecs); 
}

function getSecs() { 
   var mySecs = initStopwatch(); 
   var mySecs1 = ""+mySecs; 
   mySecs1= mySecs1.substring(0,mySecs1.indexOf(".")); 
   document.forms[0].userTime.value = mySecs1
   window.setTimeout('getSecs()',1000); 
}
</SCRIPT>

<BODY onLoad="window.setTimeout('getSecs()',1)">

<form action="checkanswer.php" method=post>
   Time spent: <input size=2 name=userTime> seconds<br>
<?php include("QuestionFactory.php");
   $userName = "clarence35";
   $questionFactory = new QuestionFactory();
   $problem = $questionFactory->makeNewQuestion('clarence35', 1);
   print $problem->question;
?>
   <input type=text name="userAnswer" size=2/>
   <input type=submit />
</form>